package UnitTest.DataStructureTest.arrayAndListTest.listTest;

import DataStructure.arrayAndList.list.Nodelj;
import DataStructure.arrayAndList.list.listRealize.ListBigIntegersMerge;
import org.junit.Test;

public class ListBigIntegersMergeTest {

    ListBigIntegersMerge lm = new ListBigIntegersMerge();
    Nodelj node = new Nodelj();

    @Test
    public void testmerge() {
        Nodelj target = lm.merge(node.Array2Nodelj(demoMerge1_1), node.Array2Nodelj(demoMerge1_2));
        assert node.equals(target, node.Array2Nodelj(answer1));
        target = lm.merge(node.Array2Nodelj(demoMerge2_1), node.Array2Nodelj(demoMerge2_2));
        assert node.equals(target, node.Array2Nodelj(answer2));
    }

    int[] demoMerge1_1 = {1, 3, 5, 7, 9};
    int[] demoMerge1_2 = {0, 2, 4, 6, 8};
    int[] answer1 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};

    int[] demoMerge2_1 = {1, 1, 2, 3, 5, 6, 6, 6, 7, 9};
    int[] demoMerge2_2 = {0, 2, 2, 2, 4, 5, 5, 6, 8};
    int[] answer2 = {0, 1, 1, 2, 2, 2, 2, 3, 4, 5, 5, 5, 6, 6, 6, 6, 7, 8, 9};
}
